//
//  MCRechargeCollectionViewCell.m
//  TLYL
//
//  Created by MC on 2017/7/13.
//  Copyright © 2017年 TLYL01. All rights reserved.
//


#import "MCRechargeCollectionViewCell.h"

@interface MCRechargeCollectionViewCell ()

@property(nonatomic,strong)UIImageView * selectedImgV;
@end

@implementation MCRechargeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self){
        [self initView];
    }
    return self;
}

-(void)setDataSource:(MCPaymentModel*)dataSource{
    _dataSource=dataSource;
    
    _titleLab.text =dataSource.PayName;
    
}

-(void)initView{
    
    self.backgroundColor = [UIColor  whiteColor];
    _titleLab =[[UILabel alloc]initWithFrame:CGRectZero];
    _titleLab.layer.cornerRadius=3;
    _titleLab.layer.borderWidth=1.0;
    _titleLab.layer.borderColor=RGB(211, 211, 211).CGColor;
    _titleLab.textColor=RGB(102, 102, 102);
    _titleLab.font=[UIFont systemFontOfSize:15];
    _titleLab.text =@"加载中";
    _titleLab.textAlignment=NSTextAlignmentCenter;
    [self  addSubview:_titleLab];
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top);
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.bottom.equalTo(self.mas_bottom);
    }];
    _selectedImgV=[[UIImageView alloc]init];
    _selectedImgV.backgroundColor=[UIColor clearColor];
    [_titleLab addSubview:_selectedImgV];
    _selectedImgV.hidden=YES;
    _selectedImgV.image=[UIImage imageNamed:@"JiaBiaoduiHao"];
    [_selectedImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(20);
        make.height.mas_equalTo(20);
        make.right.equalTo(_titleLab.mas_right);
        make.bottom.equalTo(_titleLab.mas_bottom);
    }];
}

- (void)setSelected:(BOOL)selected{
    if (selected) {
        _titleLab.textColor=RGB(54, 128, 221);
        _titleLab.layer.borderColor=RGB(54, 128, 221).CGColor;
        _selectedImgV.hidden=NO;
    }else{
        _titleLab.textColor=RGB(102, 102, 102);
        _titleLab.layer.borderColor=RGB(211, 211, 211).CGColor;
        _selectedImgV.hidden=YES;
    }
}


@end







